home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / newsgroups / misc.20000824-20010305 / 000170_news@columbia.edu _Sat Dec 30 07:42:37 2000.msg < prev    next >
Internet Message Format  |  2001-03-05  |  3KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
  3.     by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id HAA29035
  4.     for <kermit.misc@cpunix.cc.columbia.edu>; Sat, 30 Dec 2000 07:42:37 -0500 (EST)
  5. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  6.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id HAA04744
  7.     for <kermit.misc@watsun.cc.columbia.edu>; Sat, 30 Dec 2000 07:42:36 -0500 (EST)
  8. Received: (from news@localhost)
  9.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id HAA20600
  10.     for kermit.misc@watsun.cc.columbia.edu; Sat, 30 Dec 2000 07:16:29 -0500 (EST)
  11. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  12. From: Igor Sobrado <sobrado@string1.ciencias.uniovi.es>
  13. Subject: Re: Converting struct tm to time_t
  14. Date: 30 Dec 2000 12:15:01 GMT
  15. Organization: Universidad de Oviedo
  16. Message-ID: <92kjk5$66n$1@news01.si.uniovi.es>
  17. To: kermit.misc@columbia.edu
  18.  
  19. In comp.protocols.kermit.misc Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:
  20. >>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:
  21.  
  22. >  Russ> INN currently uses this, which seems to work fairly well.  I'm
  23. >  Russ> the author of this code; you can consider it to be in the
  24. >  Russ> public domain.  Note that this code requires that time_t be an
  25. >  Russ> arithmetic type, which may not work properly on some non-UNIX
  26. >  Russ> platforms (it could presumably be replaced by a long or
  27. >  Russ> something).
  28.  
  29. > heh. insert religious war about leap-second handling here :-)
  30. > (or on second thoughts, don't)
  31.  
  32. > at least some systems have a timegm() function which is the UTC
  33. > equivalent of mktime(). For those that don't, the straightforward
  34. > calculation method is probably sufficient, though an alternative
  35. > might be to do putenv("TZ=GMT0"); and then use mktime()....
  36.  
  37. In my opinion that problem should not exist in the Unix world.
  38. The best alternative is to manage all the times in Coordinated
  39. Universal Time and use things like the TZ environment variable
  40. only with the library functions that show the time. In fact, this
  41. approach avoid the need to normalize the time itself allowing a
  42. correct data management in all the time-zones. In this sense, the
  43. FTP server command MDTM works as expected, providing the last
  44. modification time of a file in UTC/GMT.
  45.  
  46. By the way, MDTM should be (but is not) implemented in all the
  47. FTP servers at present, but will be included in the next FTP RFC.
  48. Frank, probably this fact should be checked by C-Kermit too!
  49.  
  50. Another problem, as noted by Russ Allbery is that not all the
  51. operating systems will manage time_t in the same way as Unix.
  52. But Unix manages both time_t and a struct tm at present making
  53. data manipulation more complex that it should be.
  54.  
  55. Best wishes,
  56. Igor.
  57.  
  58. -- 
  59. Igor Sobrado, UK34436 - sobrado@acm.org